﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;

namespace EncryptHelper
{
   public class JSHelper
    {
        #region 重载方法的使用
        /// <summary>
        /// 弹出提示框
        /// </summary>
        /// <param name="page"></param>
        /// <param name="msg"></param>
        public static void Alert(Page page, string msg)
        {
            page.ClientScript.RegisterStartupScript(page.GetType(), "alert", $"<script>alert('{msg}');</script>");
        }

        /// <summary>
        /// 弹出提示框并实现跳转
        /// </summary>
        /// <param name="page"></param>
        /// <param name="msg"></param>
        /// <param name="url"></param>
        public static void Alert(Page page, string msg, string url)
        {
            page.ClientScript.RegisterStartupScript(page.GetType(), "alert", $"<script>alert('{msg}');location.href='{url}';</script>");
        } 
        #endregion
    }
}
